package com.starinside.wp.repository;

import com.starinside.wp.domain.Praises;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;
import org.springframework.stereotype.Repository;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

/**
 * @Describle This Class Is 动态赞
 * @Author ZengMin
 * @Date 2018/11/9 14:13
 * @Company Matt
 */
@Repository
public interface PraisesRepository extends JpaRepository<Praises,String> {

    @Transactional
    @Modifying
    @Query("delete from Praises p where p.uid = ?1 and p.fid = ?2")
    int deleteByUidAndFid(String uid, String fid);

    Praises findByUidAndFid(String uid, String fid);

    List<Praises> findByUidAndFidIn(String uid, List<String> fids);
}
